<div class="app-container with-navbar with-tabbar" ng-controller="InfoController">
    <div class="navbar fixed-top">
        <div class="navbar-left hide-weixin" ng-click="goBack()">
            <img class="button-icon" src="image/nav-left.png"/>
            <!-- div class="button-text">返回</div -->
        </div>
        <div class="navbar-title">
            {{goods.goods_name}}
        </div>
    </div>
    <div class="app-content">
        <!-- Photo -->
        <div ng-if="isLoaded && goods">
            <img style="width: 100%;" ng-src="image/default-photo.png" lazy-img="{{goods.cover_img}}" />
        </div>
        <!-- Info -->
        <div class="product-info" ng-if="isLoaded && goods">
            <div class="info-name">
            	<span style="font-size: 20px; color: #000;">{{goods.goods_name}}</span>
            	<br><span style="font-size: 14px; color: #6f6f6f; line-height: 2;">{{goods.abstract}}</span>
            </div>
            <div class="info-price" style="margin-top: 2px;">
                <span class="price-shop" style="font-size: 20px; color: red;">{{goods.price/100| currency:"￥"}}</span>
                <span class="price-market">{{goods.market_price/100| currency:"￥"}}</span>
            </div>
            <div style="color: #bbbbbb;font-size: 0.32rem;padding: 0.2rem 0 0.4rem 0;">
                <span class="block">已售卖<em> {{goods.total_sales}} </em>笔</span>
            </div>
        </div>
        <!-- Amount -->
        <div class="product-amount" ng-if="isLoaded && goods">
            <div class="amount-name">数量</div>
            <div class="amount-input" ng-class="{active: canPurchase}">
                <div class="input-button" ng-class="{active: input.currentAmount > 1}" ng-click="touchAmountSub()">
                    <img src="image/ind-sub.png">
                </div>
                <input type="text" class="input-count" ng-class="{active: input.currentAmount > 0}" ng-model="input.currentAmount"  ng-change="refreshAmount()">
                </input>
                <div class="input-button" ng-class="{active: input.currentAmount > 0}" ng-click="touchAmountAdd()">
                    <img src="image/ind-add.png">
                </div>
            </div>
        </div>
        <!-- Comment -->
        <div class="product-comment" ng-if="isLoaded && goods && comments && comments.total">
            <div class="comment-header" ng-click="touchComment()">
                <img class="header-arrow" src="image/nav-right.png"/>
                <div class="header-title">商品评价（{{comments.total}}）</div>
            </div>
            <div class="comment-item" ng-repeat="comment in comments.rows track by $index" ng-click="touchComment()">
                <div class="item-info">
                    <span class="user">{{comment.is_anonymous ? '匿名用户' : comment.username}}</span>
                    <span class="rate">{{comment.level==1?'差评':(comment.level==2?'中评':'好评')}}</span>
                    <span class="time">{{comment.created_at}}</span>
                </div>
                <div class="item-body">
                    {{comment.content}}
                </div>
                <div class="comment-line" ng-if="$index == (comments.length-1)"></div>
            </div>
        </div>
        <!-- Introduction -->
        <div class="product-intro" ng-if="isLoaded && goods">
            <div class="intro-header">
                产品详情
            </div>
            <div class="intro-content" style="padding: 0px;" ng-bind-html="(goods.goods_desc || '没有产品详情') | trustHtml"></div>
        </div>
        <!-- Submit -->
        <div class="product-submit fixed-bottom" ng-if="isLoaded && goods">
            <div class="submit-cart" ng-click="touchCart()">
                <img class="cart-icon" src="image/ind-cart.png">
                <div class="cart-badge" ng-if="cartModel.total > 0">
                    {{cartModel.total}}
                </div>
            </div>
            <div class="submit-button" ng-class="{active: canPurchase}" ng-click="touchAddCart()">
                加入购物车
            </div>
            <div class="submit-button" style="background-color: red; color: #ffffff;" ng-class="{active: canPurchase}" ng-click="touchPurchase()">
                立即购买
            </div>
        </div>
        <!-- Tips -->
        <div class="product-tips" ng-if="isLoaded && !goods">
            所选商品暂时无货，非常抱歉！
        </div>
    </div>
</div>
